package com.tang.controller;


import com.tang.dto.talkDto;
import com.tang.sys.ResponseResult;
import com.tang.sys.entity.Images;
import com.tang.sys.entity.Talk;
import com.tang.sys.service.ITalkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/talk")
public class AdminTalkController {
    @Autowired
    private ITalkService iTalkService;

    @GetMapping("/list")
    //获取全部说说
    public ResponseResult getAllList(Integer pageNum, Integer pageSize, talkDto talkdto){

        return iTalkService.getAllList(pageNum,pageSize,talkdto);
    }
    //新增说说
    @PostMapping
    public ResponseResult addTalk(@RequestBody Talk talk){

        return iTalkService.addTalk(talk);
    }
    //删除
    @DeleteMapping("{id}")
    public ResponseResult deleteTalk(@PathVariable("id") Long id){

        return iTalkService.deleteTalk(id);
    }

    //修改
    @GetMapping("{id}")
    public ResponseResult getTalkinfo(@PathVariable("id") Long id){

        return iTalkService.getTalkinfo(id);
    }
    @PutMapping
    public ResponseResult updateTalk(@RequestBody Talk talks){

        return iTalkService.updateTalk(talks);
    }
}
